function addModule(){
	var module = $("#txtModule").val();
	if(module == ""){
		layer.alert("邮件模板不能为空~~", 2);
		return;
	}
	var base = new Object();
	base.moduleContent = module;
	base.moduleName = "邮件模板";
	var json = JSON.stringify(base);
	$.ajax({
		type: "post",
		data: json,
		contentType: "application/json",
		dataType: "text",
		url: "/meileche/email.do?action=1",
		success: function(v){
			if(v == "3"){
				layer.alert("添加成功", 9);
				window.location.href="emailModule.jsp";
			}else if(v == "1"){
				layer.alert("更新邮件模板成功~~~", 9);
				window.location.href="emailconfig.jsp";
			}else if(v == "4"){
				layer.alert("添加失败~~~", 8);
			}else if(v == "2"){
				layer.alert("更新邮件模板失败~~~", 8);
			}
		}
	});
}

function returnModule(){
	window.location.href="emailconfig.jsp";
}
$(function(){
	var args = window.location.search;
	if(args != ""){
		$("#btnAdd").hide();
		$.ajax({
			type: "get",
			dataType: "text",
			url: "/meileche/admin/email.do?action=0&moduleName=邮件模板",
			success: function(v){
				if(v != ""){
					eval("var info = "+ v);
					$("#txtModule").val(info.moduleContent);
				}
			}
		});
	}else{
		$("#btnModify").hide();
	}
});